package it.gat.util.dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

import it.gat.dao.*;
import it.gat.dao.impl.*;

public class MySQLDAOFactory extends DAOFactory{

	public static final String DRIVER="com.mysql.jdbc.Driver";

	private static Connection conn;

	public static Connection createConnection() {
		try {
			if (conn==null)
			{
				Class.forName(DRIVER);
				conn = DriverManager.getConnection(dbUrl,dbUsername, dbPassword);
			}
		} catch (ClassNotFoundException cnfex)
		{
			cnfex.printStackTrace();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return conn;
	}
		  
	public ClienteDAO getClienteDAO() {
		    return new MySQLClienteDAOImpl();
		  }
	
	public SedeDAO getSedeDAO() {
		return new MySQLSedeDAOImpl();
	}
	
	public UtenteDAO getUtenteDAO() {
		return new MySQLUtenteDAOImpl();
	}
	
	public ArticoloDAO getArticoloDAO() {
		return new MySQLArticoloDAOImpl();
	}
	
	public TipologiaDispositivoDAO getTipologiaDispositivoDAO() {
		return new MySQLTipologiaDispositivoDAOImpl();
	}
	
	public TicketDAO getTicketDAO() {
		return new MySQLTicketDAOImpl();
	}
	
	public AppuntamentoDAO getAppuntamentoDAO() {
		return new MySQLAppuntamentoDAOImpl();
	}
	
	public RapportoInterventoDAO getRapportoInterventoDAO() {
		return new MySQLRapportoInterventoDAOImpl();
	}
	
	public DispositivoSostituitoDAO getDispositivoSostituitoDAO() {
		return new MySQLDispositivoSostituitoDAOImpl();
	}
	
	public ContrattoDAO getContrattoDAO() {
		return new MySQLContrattoDAOImpl();
	}
	
	public PermessoUtenteDAO getPermessoUtenteDAO() {
		return new MySQLPermessoUtenteDAOImpl();
	}
	
	public PermessoDAO getPermessoDAO() {
		return new MySQLPermessoDAOImpl();
	}


}
